
const autoprefixer = require('autoprefixer');
const pxtorem = require('postcss-pxtorem');
const merge = require('webpack-merge');

const webpack = require("webpack")
module.exports = {
    css: {
        loaderOptions: {
            postcss: {
                plugins: [
                    autoprefixer({
                        browsers: ['Android >= 4.0', 'iOS >= 7']
                    }),
                    pxtorem({
                        rootValue: 37.5,
                        // rootValue: 75,
                        propList: ['*'],
                    })               
                ]
            }
        }
    },
    chainWebpack: config => {
        config.module
            .rule("images")
            .use("image-webpack-loader")
            .loader("image-webpack-loader")
            .options({
                bypassOnDebug: true
            });
        config.module
            .rule("images")
            .test(/\.(png|jpe?g|gif|webp)(\?.*)?$/)
            .use("url-loader")
            .loader("url-loader")
            .tap(options =>
                merge(options, {
                    limit: 1000000000000000000 /// 文件大小 单位为 B（低于这个才会base64编码）
                })
            );
    },
    devServer: {
        open: true, //浏览器自动打开页面
        host: "localhost", //本地服务器访问的路径
        port: 8080, //本地服务器访问的端口
        proxy: {
			//配置跨域/*  */
			'/api': {/*  */
				target: 'http://localhost:3000',
				ws: true,
				changeOrigin: true,
				pahtRewrite: {
					'^/api': '',
				}
			}
		}
        
    },
    configureWebpack: {
        plugins: [
          new webpack.ProvidePlugin({
                $:"jquery",
                jQuery:"jquery",
                "windows.jQuery":"jquery"
            })
        ]
      }
};